//
//  PhotoTableViewCell.h
//  XPhoto
//
//  Created by baboy on 2019/6/27.
//  Copyright © 2019 baboy. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "Post.h"
#import "TagView.h"
#import "BKPhotoScrollView.h"
#import "BKTextView.h"
NS_ASSUME_NONNULL_BEGIN
#define PHOTO_TABLE_VIEW_CELL_REUSE_ID  @"PhotoTableViewCell"

typedef NS_ENUM(NSInteger, PhotoTableViewCellStyle) {
    PhotoTableViewCellStyleDefault          = 0,
    PhotoTableViewCellStyleNoAction     = 1
};

@protocol PhotoTableViewCellDelegate;

@interface PhotoTableViewCell : UITableViewCell<UITextViewDelegate, TagViewDelegate>
@property(nonatomic, strong) Post *post;
@property(nonatomic, strong) IBOutlet UIButton *userAvatarButton;
@property(nonatomic, strong) IBOutlet UILabel *userNameLabel;
@property(nonatomic, strong) IBOutlet BKPhotoScrollView *photoScrollView;
@property(nonatomic, strong) IBOutlet BKTextView *likeDescTextView;
@property(nonatomic, strong) IBOutlet BKTextView *contentTextView;
@property(nonatomic, strong) IBOutlet UIButton *shareButton;
@property(nonatomic, strong) IBOutlet UIButton *likeButton;
@property(nonatomic, strong) IBOutlet UIButton *favButton;
@property(nonatomic, strong) IBOutlet UIButton *commentButton;
@property(nonatomic, strong) IBOutlet TagView *tagView;
@property(nonatomic, strong) IBOutlet UIView *actionBar;
@property(nonatomic, strong) IBOutlet UILabel *timeLabel;
@property(nonatomic, assign) id<PhotoTableViewCellDelegate, TagViewDelegate> delegate;
@property(nonatomic, assign) PhotoTableViewCellStyle style;
@property(nonatomic, strong) IBOutlet UIView *commentListView;
@property(nonatomic, strong) IBOutlet UIButton *commentAvatarButton;
@property(nonatomic, strong) IBOutlet UIButton *addCommentButton;
@property(nonatomic, strong) IBOutlet UIView *commentWrapperView;
@property(nonatomic, strong) IBOutlet UIButton *menuButton;

//- (CGFloat)cellHeightWithPost:(Post*)post width:(CGFloat)width;
- (IBAction)clickShareButton:(nullable id)sender;
- (IBAction)clickLikeButton:(nullable id)sender;
- (IBAction)clickFavButton:(nullable id)sender;
- (IBAction)clickCommentButton:(nullable id)sender;
- (IBAction)clickAddCommentButton:(nullable id)sender;
- (IBAction)clickMenuButton:(nullable id)sender;
- (IBAction)clickUserAvatarButton:(nullable id)sender;
@end



@protocol PhotoTableViewCellDelegate <NSObject>
@optional
- (void)photoTableViewCell:(id)photoTableViewCell didSelectSerial:(PostSerial *)postSerial ofPost:(Post*)post;
- (void)photoTableViewCell:(id)photoTableViewCell didSelectLocationOfPost:(Post*)post;
- (void)photoTableViewCell:(id)photoTableViewCell didSelectTag:(NSString *)tag ofPost:(Post *)post;

- (void)photoTableViewCellDidClickAddrButton:(id)photoTableViewCell;
- (void)photoTableViewCellDidClickShareButton:(id)photoTableViewCell;
- (void)photoTableViewCellDidClickLikeButton:(id)photoTableViewCell;
- (void)photoTableViewCellDidClickFavButton:(id)photoTableViewCell;
- (void)photoTableViewCellDidClickCommentButton:(id)photoTableViewCell;
- (void)photoTableViewCellDidClickAddCommentButton:(id)photoTableViewCell;
- (void)photoTableViewCellDidClickLikeCountView:(id)photoTableViewCell;
- (void)photoTableViewCellDidClickCommentCountView:(id)photoTableViewCell;
- (void)photoTableViewCellDidClickMenuButton:(id)photoTableViewCell;
- (void)photoTableViewCellDidClickUserAvatarButton:(id)photoTableViewCell;

- (void)photoTableViewCell:(id)photoTableViewCell openLink:(NSURL *)url;

@end

NS_ASSUME_NONNULL_END
